package si.yun.web;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import si.yun.entity.OpCourseList;
import si.yun.service.OpesService;
import si.yun.utils.JsonData;

import java.util.List;
import java.util.Map;

/**
 * @ClassName OpeHomeWeb
 * @description:
 * @Author DZQ
 * @Date 2021/7/29 16:08
 **/
@RestController
@RequestMapping("/OpeHomes")
public class OpeHomesWeb {
    @Autowired
    private OpesService service;

    /**
     * @author: DZQ
     * @description: 获取Ztree数据
     * @date: 2021/8/24 9:16
     * @return
     */
/*
    @RequestMapping("/getztree")
    public JsonData getztree(Integer parentId){
        List<Map<String , Object>> count=service.getztree(parentId);
        return count!=null?JsonData.buildSuccess(count):JsonData.buildError("无数据");
    }
*/
    /**
     * @author: DZQ
     * @description: 获取课程订单信息
     * @date: 2021/8/25 14:38
     * @return JsonData
     */
    @PostMapping("/status")
    public JsonData status(Integer orderType){
        List<Map<String,Object>> list=service.status(orderType);
        return list!=null?JsonData.buildSuccess(list):JsonData.buildError("服务器段错误");
    }

    /**
     * @author: DZQ
     * @description: 获取课程订单状态信息
     * @date: 2021/8/25 14:38
     * @return JsonData
     */
    @PostMapping("/COStatus")
    public JsonData COStatus(Integer orderStatus,Integer orderType){
        List<Map<String,Object>> list=service.COStatus(orderStatus,orderType);
        return list!=null?JsonData.buildSuccess(list):JsonData.buildError("服务器段错误");
    }


    /**
     * @author: DZQ
     * @description: 查询订单状态列表
     * @date: 2021/8/27 15:59
     * @return JsonData
     */
    //查询
    @PostMapping("/query")
    public JsonData query(Integer orderNo,Integer account,Integer orderPaymentChannel,Integer orderStatus,Integer orderType) {
        List<Map<String,Object>> list=service.query(orderNo,account,orderPaymentChannel,orderStatus,orderType);
        return list!=null?JsonData.buildSuccess(list):JsonData.buildError("服务器段错误");
    }

    /**
     * @author: DZQ
     * @description: 订单状态数量
     * @date: 2021/8/15 9:53
     * @return
     */
    @PostMapping("/getNumber")
    public Map<String,Object> getNumber(int result1,int result2,int result3,int result4){
        Map<String,Object> list=service.getNumber(result1,result2,result3,result4);
        return list;
    }
    /**
     * @author: DZQ
     * @description: 查看订单详情
     * @date: 2021/9/4 19:44
     * @return
     */
    @PostMapping("/selOul")
    public JsonData selOul(Integer id) {
        Map<String, Object> list = service.selOul(id);
        return list != null ? JsonData.buildSuccess(list) : JsonData.buildError("服务器报错");
    }
    /**
     * @author: DZQ
     * @description: 高级检索得到的表格
     * @date: 2021/9/10 9:19
     * @return
     */
    @PostMapping("/Retrieve")
    public JsonData Retrieve(Integer orderSource,String createDate,Integer orderNo,Integer account,Integer orderPaymentChannel,Integer orderStatus,Integer orderType) {
        List<Map<String,Object>> list=service.Retrieve(orderSource,createDate,orderNo,account,orderPaymentChannel,orderStatus,orderType);
        return list!=null? JsonData.buildSuccess(list):JsonData.buildError("服务端异常");
    }
}
